//
//  TouchView.m
//  UI04_事件_触摸_手势
//
//  Created by LGC on 16/3/14.
//  Copyright © 2016年 Apon. All rights reserved.
//

#import "TouchView.h"


@implementation TouchView

#pragma mark - 重写touch方法
/** 触摸开始时 */
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    NSLog(@"开始点击");
}

/** 触摸移动时 */
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesMoved:touches withEvent:event];
//    if ([self.delegate respondsToSelector:@selector(exchangeColor:)]) {
//        [self.delegate exchangeColor:self];
//    }
    NSLog(@"移动");
}

/** 触摸结束时 */
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesEnded:touches withEvent:event];
    // 通知代理人触摸结束时执行协议方法.
    if ([self.delegate respondsToSelector:@selector(exchangeColor:)]) {
        [self.delegate exchangeColor:self];
    }
    
    NSLog(@"松手");
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/



@end
